<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=UTF-8" />
<title>修改会员</title>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<link href="../../css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript" src="../../js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="../../js/select-ui.min.js"></script>
<script type="text/javascript" src="../../editor/kindeditor.js"></script>

<!--<script type="text/javascript">
	KE.show({
		id : 'content7',
		cssPath : './index.css'
	});
</script>-->


<script type="text/javascript">
	$(document).ready(function(e) {
		$(".select1").uedSelect({
			width : 345
		});
		$(".select2").uedSelect({
			width : 167
		});
		$(".select3").uedSelect({
			width : 100
		});

		$("#name").focus(function() {
			$(this).css("background-color", "#0FF")
			var text = $(this).val();
			if (text == "请填写姓名") {
				$(this).val("");
			}
		});

		$("#name").blur(function() {
			$(this).css("background-color", "#FFF")
			var text = $(this).val();
			if (text == "") {
				$(this).val("请填写姓名");
			}
		});

	});

	function checkidentity() {
		var id = $("#idCard").val();
		var notice2 = $("#notice2");
		var regid = /^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
		if (regid.test(id) == false) {
			$(notice2).html("身份证输入不合法");
			return false;
		} else {
			$(notice2).html("");
			return true;
		}
	}

	function checkphone() {
		var id = $("#phone").val();
		var notice3 = $("#notice3");
		var regid = /^[1-9]{8,11}$/;
		if (regid.test(id) == false) {
			$(notice3).html("电话号码输入不合法");
			return false;
		} else {
			$(notice3).html("");
			return true;
		}
	}
</script>
</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">会员管理</a>
			</li>
			<li><a href="#">修改会员</a>
			</li>
		</ul>
	</div>

	<div class="formbody">


		<div id="usual1" class="usual">

			<div class="itab">
				<ul>
					<li><a href="#tab1" class="selected">修改会员</a>
					</li>

				</ul>
			</div>

			<div id="tab1" class="tabson">

				<div class="formtext">
					Hi，<b>admin</b>，修改会员信息
				</div>
				<form action="updateVip.s" method="post">
					<ul class="forminfo">
					<li><label>会员卡号<b>*</b>
						</label><input name="vipId" type="text" class="dfinput"
							value="result" id="vipId" readonly="readonly" />
						</li>
					
						<li><label>会员姓名<b>*</b>
						</label><input name="name" type="text"  class="dfinput"
							value="" id="name" />
						</li>

						<li><label>性别<b>*</b>
						</label>


							<div style="padding-top:7px ">
							 

	    <input type="radio" name="sex" checked="checked" value="男" />男
	    


	    <input type="radio" name="sex"   value="女" />女

								<!--  <input type="radio" name="sex" value="${vipOne.sex }" />男 <input
									type="radio" name="sex" value="${vipOne.sex }" />女-->
							</div></li>

						<li>
							<div style="position:relative">
								<label>身份证号码<b>*</b>
								</label> <input name="idcard" type="text" class="dfinput"
									onblur="checkidentity()" id="idCard"
									value="" />
							</div>
							<div id="notice2"
								style=" font-size:14px; color:red;position:absolute; z-index:1000; margin-top:-30px; margin-left:    450px">
							</div></li>


						<li>
							<div>
								<label>手机号码<b>*</b>
								</label> <input name="phone" type="text" class="dfinput"
									value="" id="phone" onblur="checkphone()" />
							</div>
							<div id="notice3"
								style=" font-size:14px; color:red;position:absolute; z-index:1000; margin-top:-30px; margin-left:    450px">
							</div></li>


						<!--  <li><label>备注消息</label> <textarea id="content7"
								name="content"
								style="width:700px;height:250px;visibility:hidden;"></textarea>

						</li>-->
						<li><label>&nbsp;</label><input name="tj" type="button" onclick="update()"
							class="btn" value="确认" />
						</li>
					</ul>
				</form>
				<script>
					window.onload=function () {
                        document.getElementById('vipId').value = localStorage.getItem('vipId');
                        document.getElementById('name').value = localStorage.getItem('name');
                        document.getElementById('idCard').value = localStorage.getItem('idCard');
                        document.getElementById('phone').value = localStorage.getItem('phone');
                    }
				</script>

				<script>
					function update() {
                        confirm("确认修改吗？");
                        var vipId = $("#vipId").val();
                        var name = $("#name").val();
                        var sex = $("input[type='radio']:checked").val();
                        var idCard = $("#idCard").val();
                        var phone = $("#phone").val();
                        $.ajax({
                            url: "../../vip/update",
                            type: "POST",
                            data: {
                                vipId: vipId,
                                name: name,
                                sex: sex,
                                idCard: idCard,
                                sex: sex,
                                phone: phone,
                            },
                            success: function (data, status) {
                                if (status == "success") {
                                    console.log('请求成功');
                                    console.log(data);
                                    if (data.state == 0) {
                                        window.location = "conditionvipmanage.html";
                                    } else {
                                        alert("修改失败")
                                    }

                                }
                            },
                            error: function () {
                                console.log('请求失败');
                            }
                        })
                    }
				</script>
			</div>
</body>

</html>
